const mongoose = require("mongoose");
const carSchema = new mongoose.Schema({
	carnumber: String, //车牌号
	brand: String, //品牌比如宝马奔驰
	ownerid: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "userModel",
	}, //车主ids
	rent: Number, //租金按天算
	carImg: Array, //汽车正侧图片
	idCardImg: Array, //身份证正反图片
	drivingImg: String, //行驶证图片
	location: {
		longitude: {
			type: Number,
			default: "",
		}, //经度
		latitude: {
			type: Number,
			default: "",
		}, //纬度
	},
	type: String, //车型，如轿车和SUV
	reason:String,//失败原因
	rentalState: String, //0为待出租  1为已出租  2下架 
	checkState: String, //0为审核中,1为审核成功  2为审核失败
});

//建立模型，第一个参数为模型名字可以任意取，第三个参数为mongodb数据库里实际那个数据集合的名字
mongoose.model("carModel", carSchema, "car");
